import turtle


def dragon(curve, n, size):
    if n == 0:
        return

    for i in curve:  # 起始位置
        if i == 'H':  # 水平
            dragon('HLVF', n - 1, size)
        elif i == 'V':  # 垂直
            dragon('FHRV', n - 1, size)
        else:
            if i == 'F':
                turtle.fd(size)
            elif i == 'L':
                turtle.lt(90)
            elif i == 'R':
                turtle.rt(90)


def main():
    turtle.title("龙形曲线")
    width = 900
    height = 800
    startX = 200
    startY = 0
    turtle.setup(width, height, startX, startY)
    turtle.pensize(1)
    turtle.tracer(2)
    turtle.hideturtle()
    turtle.left(90)
    turtle.bgcolor("#000")
    turtle.pencolor("#fff")
    dragon("V", 10, 6)
    turtle.done()


main()
